<template>
    <a-comment v-for="msg in data" :key="msg.msgId">
        <template #actions>
            <span key="time">{{ msg.time }}</span>
        </template>
        <template #author><a>{{ msg.userName }}</a></template>
        <template #content>
            <p v-if="msg.type == 9">
                <span v-if="msg.userId == 0">您对帖子 <a>{{ msg.targetName }}</a> 的举报审核通过，该帖子已封禁！</span>
                <span v-if="msg.userId == 1">您对评论 <a>{{ msg.targetName }}</a> 的举报审核通过，该评论已封禁！</span>
                <span v-if="msg.userId == 2">您对用户 <a>{{ msg.targetName }}</a> 的举报审核通过，该用户已封禁！</span>
                <a-badge :count="msg.checked === 1 ? 0 : 1" style="float:right;marign-right:10px" />
            </p>
            <p v-if="msg.type == 10">
                <span v-if="msg.userId == 0">抱歉！进过审查，未发现您对帖子 <a>{{ msg.targetName }}</a> 举报中的违规行为！</span>
                <span v-if="msg.userId == 1">抱歉！进过审查，未发现您对评论 <a>{{ msg.targetName }}</a> 举报中的违规行为！</span>
                <span v-if="msg.userId == 2">抱歉！进过审查，未发现您对用户 <a>{{ msg.targetName }}</a> 举报中的违规行为！</span>
                <a-badge :count="msg.checked === 1 ? 0 : 1" style="float:right;marign-right:10px" />
            </p>
            <p v-if="msg.type == 11">
                <span v-if="msg.userId == 0">您的帖子 <a>{{ msg.targetName }}</a> 被举报，经审查存在违规行为，已封禁！</span>
                <span v-if="msg.userId == 1">您的评论 <a>{{msg.targetName}}</a> 被举报，经审查存在违规行为，已封禁！</span>
                <span v-if="msg.userId == 2">您被举报，经审查存在违规行为，账号已封禁！</span>
                <a-badge :count="msg.checked === 1 ? 0 : 1" style="float:right;marign-right:10px" />
            </p>
        </template>
    </a-comment>
</template>

<script setup>
import { get, put } from '@/common'
import { ref, reactive } from 'vue'

const data = ref([])

const getList = () => {
    get("/message/report").then((res) => {
        data.value = res.data
        console.log(data.value)
        read(8)
    })
}
const read = (type) => {
  put("/message/read/" + type).then((res) => {
    console.log("success")
  })
}
getList()
</script>